package me.zhengjie.repository;

import me.zhengjie.domain.ErpChunk;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface FzChunkRepository extends JpaRepository<ErpChunk, Long>, JpaSpecificationExecutor<ErpChunk> {

    @Query(value = "SELECT f.* FROM fz_chunk f WHERE f.identifier = ?1 ",nativeQuery = true)
    List<ErpChunk> findByIdentifier(String identifier);


    @Query(value = "SELECT f.* FROM fz_chunk f WHERE f.b_id = ?1 ",nativeQuery = true)
    List<ErpChunk> findBybid(String bid);

    @Modifying
    @Query("delete from ErpChunk f where f.bId = ?1")
    int deleteByBid(String bid);
}
